Ext.define('Admin.view.training.ApplyTrainingGrid', {
	extend: 'Ext.grid.Panel',
    xtype: 'applyTrainingGrid',
    //requires: ['Ext.XTemplate'],

    title: '培训申请',
    layout: 'fit',
    //width: 750,
    //height: 600,

    collapsible: true,
    animCollapse: false,
    columnLines: true,
    //enableLocking: true,
   	bind: '{trainingDataList}',
    //store: 'Companies',

    columns: [
    {
        text: "员工ID",
        flex: 1,
        dataIndex: 'empId'
    },{
        text: "开始时间",
        width: 240,
        formatter: 'date("Y/m/d")',
        dataIndex: 'beginTime'
    }, {
        text: "结束时间",
        width: 240,
        formatter: 'date("Y/m/d")',
        dataIndex: 'overTime'
    },{
            xtype: 'actioncolumn',
            items: [{
        		xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                handler : 'openEditWindow'
            }],
            cls: 'content-column',
            width: 100,
            //dataIndex: 'bool',
            text: '审核',
            tooltip: '审核'
          }],

    plugins: [{
        ptype: 'rowexpander',
        rowBodyTpl : new Ext.XTemplate(
            '<p><b>培训地点:</b> {address}</p>',
            '<p><b>培训类型:</b> {type}</p>',
            '<p><b>培训内容:</b> {content}</p>',
            '<p><b>培训课时:</b> {hour}</p>',
            '<p><b>培训主办单位:</b> {organizer}</p>',
            '<p><b>证明人:</b> {prover}</p>',
        {
            formatChange: function(v){
                var color = v >= 0 ? 'green' : 'red';
                return '<span style="color: ' + color + ';">' + Ext.util.Format.usMoney(v) + '</span>';
            }
        })
    }],
    columnLines: true,
	bbar: {
	    xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{trainingDataList}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        /*items:[
            '-', {
            text: '批量删除',
            listeners: {
			    click:'deleteTrainings'
			}
        }]*/
    }
});